package com.cloud;

import com.cloud.service.HelloService;
import org.apache.dubbo.common.extension.ExtensionLoader;

import java.util.Set;

/**
 * @author stevejson
 */
public class DubboSpiMain {
    public static void main(String[] args) {
        ExtensionLoader<HelloService> extensionLoader = ExtensionLoader.getExtensionLoader(HelloService.class);
        // 在impl下的META-INF/dubbo获取扩展点
        Set<String> supportedExtensions = extensionLoader.getSupportedExtensions();
        System.out.println(supportedExtensions);
        for (String supportedExtension : supportedExtensions) {
            HelloService extension = extensionLoader.getExtension(supportedExtension);
            String s = extension.sayHello();
            System.out.println(s);
        }
    }
}
